The Ontario and Quebec Railway (O&Q) is a historic Canadian railway located in eastern Ontario.
The railway had received a charter in 1881 and the Canadian Pacific Railway (CPR) gained control, building the O&Q line between Perth and Toronto. CPR eventually expanded its base in southern and eastern Ontario through the acquisition of additional railways such as the Toronto Grey & Bruce Railway, the Credit Valley Railway, and the Canada Central Railway.
The CPR formalized its association with the O&Q by obtaining a 999 year lease on it in 1884 (It expires 2883). By 1890, this lease gave the CPR an extensive network in Ontario and Quebec, with lines reaching between Quebec City, Quebec, and Windsor, Ontario, as well as a line running from near Ottawa, Ontario to a connection with the CPR at Mattawa.
The CPR never owned all of the O&Q, a fact that caused legal problems when it attempted to sell off some O&Q real estate in Toronto that had become quite lucrative. However, the CPR won the court battle.
While the O&Q and the TG&B existed on paper until 1998, when they were merged into the St. Lawrence and Hudson Railway, they had always been operated as part of the CPR system.